package com.imooc.sell.utils;

import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;

import java.util.Date;

public class KeyUtil {
    static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
    String YYYYMMDD_HHMMSS = "yyyyMMdd HHmmss";
    String YYYYMMDDHHMMSSSSS = "yyyyMMddHHmmssSSS";
    String YYMMDDHHMMSS = "yyMMddHHmmss";
    String YYMMDDHHMM = "yyMMddHHmm";
    String YYYYMMDD = "yyyyMMdd";
    String YYYY_MM_DD = "yyyy-MM-dd";
    String YYYY = "yyyy";
    String YYMMDD = "yyMMdd";
    String HHMMSS = "HHmmss";
    String HHMM = "HHmm";
    String MMDD = "MMdd";
    String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
    String YYYYMMDD_HH_MM_SS = "yyyyMMdd HH:mm:ss";
    String YYYY_MM_DD_HH_MM_SS_SSS = "yyyy-MM-dd HH:mm:ss.SSS";


    public static String getUniqueKey(){
        String format = DateFormatUtils.format(new Date(), YYYYMMDDHHMMSS);
        return format+RandomStringUtils.random(6,false,true);
    }
}
